package com.example.rabbitmq.entity;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Properties;

/**
 * @Author songyahui
 * @Date 2023/7/7 10:00
 * @Description
 */
public class RabbitmqInfoPo {

    private String host;
    private String userName;
    private String passWd;

    public static RabbitmqInfoPo getObject() throws IOException, URISyntaxException {
        RabbitmqInfoPo po = new RabbitmqInfoPo();

        URL resource = RabbitmqInfoPo.class.getResource("/rabbitmq_config.properties");
        InputStream inputStream=new FileInputStream(resource.toURI().getPath());

        Properties properties=new Properties();
        properties.load(inputStream);
        po.setHost(properties.getProperty("host"));
        po.setUserName(properties.getProperty("userName"));
        po.setPassWd(properties.getProperty("passWd"));
        return po;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWd() {
        return passWd;
    }

    public void setPassWd(String passWd) {
        this.passWd = passWd;
    }
}
